import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { GraphContainerComponent } from './graph-container/graph-container.component';
import { StageService } from './stage.service';


@Component({
  selector: 'dws-sage',
  templateUrl: './stage.component.html',
  styleUrls: ['./stage.component.scss']
})
export class StageComponent implements OnInit, OnDestroy {

  @ViewChild('dwsGraph', { static: false })
  dwsGraph: GraphContainerComponent
  // eslint-disable-next-line @typescript-eslint/member-ordering
  constructor(private stageService: StageService) { }

  toolEvent(event: string) {
    switch (event) {
      case 'zoomOut':
        this.dwsGraph.zoomOut();
        break;
      case 'zoomIn':
        this.dwsGraph.zoomIn();
        break;
      case 'undo':
        this.dwsGraph.undo();
        break;
      case 'redo':
        this.dwsGraph.redo();
        break;
    }
  }

  ngOnInit() {

  }

  ngOnDestroy() {

  }
  stageSizeEnd($event) {
    console.log($event);
    this.stageService.stageSizeChange.next('change');
  }
}
